<?php

//sdfdsf no direct access
defined('_JEXEC') or die;

class plgContentHelloworld extends JPlugin {

    public function onContentBeforeDisplay($context, &$article, &$params, $limitstart) {
        $option = JRequest::getCmd('option');
        $view = JRequest::getCmd("view");
        if ($option != "com_content") {
            return '';
        } else {

            if ($view == "article" || $view == "category") {
                if ($this->params->get('alt-text'))
                    return '<p><strong>' . $this->params->get('alt-text') . '</strong></p>';
                else
                    return "<p>Hello World!</p>";
            }
        }
    }

    public function onContentAfterDisplay($context, &$article, &$params, $limitstart) {
        $html = '';
        $option = JRequest::getCmd('option');
        $view = JRequest::getCmd("view");
        if ($option != "com_content") {
            return '';
        } else {
            if ($view == "article") {

                if ($this->params->get('alt-text2'))
                {
  
$html .= '<style type="text/css">';
$html .= '    #rateStatus{float:left; clear:both; width:100%; height:20px;}';
$html .= '    #rateMe{float:left; clear:both; width:100%; height:auto; padding:0px; margin:0px;}';
$html .= '    #rateMe li{float:left;list-style:none;}';
$html .= '   #rateMe li a:hover,';
$html .= '    #rateMe .on{background:url(http://localhost/developerpages/templates/allrounder-j1.6/images/system/rating_star.png) no-repeat;}';
$html .= '    #rateMe a{float:left;background:url(http://localhost/developerpages/templates/allrounder-j1.6/images/system/rating_star_blank.png) no-repeat;width:12px; height:12px;}';
$html .= '    #ratingSaved{display:none;}';
$html .= '    .saved{color:red; }';
$html .= '</style>';

$html .= '<span id="rateStatus">Rate Me...</span>';
$html .= '<span id="ratingSaved">Rating Saved!</span>';
$html .= '<div id="rateMe" title="Rate Me...">';
$html .=     '<a onclick="rateIt(this)" id="_1" title="ehh..." onmouseover="rating(this)" onmouseout="off(this)"></a>';
$html .=     '<a onclick="rateIt(this)" id="_2" title="Not Bad" onmouseover="rating(this)" onmouseout="off(this)"></a>';
$html .=     '<a onclick="rateIt(this)" id="_3" title="Pretty Good" onmouseover="rating(this)" onmouseout="off(this)"></a>';
$html .=     '<a onclick="rateIt(this)" id="_4" title="Pretty Good" onmouseover="rating(this)" onmouseout="off(this)"></a>';
$html .=     '<a onclick="rateIt(this)" id="_5" title="Pretty Good" onmouseover="rating(this)" onmouseout="off(this)"></a>';	
$html .= '</div>';
$html .= '<p>test </p>';



$html .= '<script type="text/javascript" language="javascript" src="http://localhost/developerpages/plugins/content/helloworld/ratingsys.js"></script>';                    
                    return $html;
                }
                else
                    return "<p>Hello World!</p>";
            }
        }
    }

}

?>